


local ensure_packer = function()
    local fn = vim.fn
    local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
    if fn.empty(fn.glob(install_path)) > 0 then
        fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
        vim.cmd [[packadd packer.nvim]]
        return true
    end
    return false
end

local packer_bootstrap = ensure_packer()



-- 从这里开始安装插件
return require('packer').startup(function(use)
    --nvim tree
    use {
        'nvim-tree/nvim-tree.lua',
        requires = {
            'nvim-tree/nvim-web-devicons', -- optional
        },
    }

    -- telescope
    use {
        'nvim-telescope/telescope.nvim', tag = '0.1.6',
        -- or                            , branch = '0.1.x',
        requires = { {'nvim-lua/plenary.nvim'} }
    }

    --fzf install 
   -- use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release' }
   use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }

-- 打标签
use "MattesGroeger/vim-bookmarks"
-- telescope查询标签支持
use "tom-anders/telescope-vim-bookmarks.nvim"


    ------------------------------------------------------------------------------------------

    -- 配置 bufferline 
    --
    -- using packer.nvim
    use {'akinsho/bufferline.nvim', tag = "*", requires = 'nvim-tree/nvim-web-devicons'}



    --------------------------------------------------------------------------------------------
    -- 配置nerdcommerter

    use({"preservim/nerdcommenter"})
    ----------------------------------------------------------------------------------------------
    ---安装 lastplace

    use 'ethanholz/nvim-lastplace'
    -----------------------------------------------------------------------------
    --安装 treesitter

    use({"nvim-treesitter/nvim-treesitter"})

    ---------------------------------------------------------
    ---安装主题

    use ({"rebelot/kanagawa.nvim"})



    ---------------------------------------------------------------------------------------------
    --安装lualine
    use {
        'nvim-lualine/lualine.nvim',
        requires = { 'nvim-tree/nvim-web-devicons', opt = true }
    }


    ---------------------------------------------------------------------------------------------
    -- 安装 flash.nvim 跳转插件

    use ({"folke/flash.nvim"})



    ---------------------------------------------------------------------------------------------

    --安装 mason 语法服务器
    use {
        "williamboman/mason.nvim",
        "williamboman/mason-lspconfig.nvim",
        "neovim/nvim-lspconfig",
    }


    --use {
    --    "williamboman/mason.nvim"
    --}


    --use {
    --    "williamboman/mason-lspconfig.nvim"
    --}


    ---------------------------------------------------------------------------------------------

    --安装 neodev 插件
    use({"folke/neodev.nvim"})




    ---------------------------------------------------------------------------------------------

    --use {"neovim/nvim-lspconfig"}


    ---------------------------------------------------------------------------------------------
    --安装 竖线对齐
--    use {"lukas-reineke/indent-blankline.nvim"}


    --------------------------------------------------------------------------------------------------
    --安装 光标下的单词高亮
    use {"RRethy/vim-illuminate"}




    ----------------------------------------------------------------------------------------------------




    --关于补全框架的安装
    use {"knubie/nvim-cmp"}

    --对于路径的补全的插件
    --use {"hrsh7th/cmp-path"}







    --关于路径的补全
    use 'hrsh7th/cmp-path'


    --关于各个语言的补全
    use 'hrsh7th/cmp-nvim-lsp'

    --安装luasnip 引擎
    use 'L3MON4D3/LuaSnip'
    --安装snip 源
    use 'rafamadriz/friendly-snippets'
    --安装 将snip源转化为 cmp的源的插件
    use 'saadparwaiz1/cmp_luasnip'

    --安装buffer 的补全
    use 'hrsh7th/cmp-buffer'

    --安装 command line 
    use 'hrsh7th/cmp-cmdline'

    --安装markdown 插件
    use {"ellisonleao/glow.nvim", config = function() require("glow").setup() end}






    ----------------------------------------------------------------------------------------------------
    ---
    use 'wbthomason/packer.nvim'
    -- My plugins here
    -- use 'foo1/bar1.nvim'
    -- use 'foo2/bar2.nvim'

    -- Automatically set up your configuration after cloning packer.nvim
    -- Put this at the end after all plugins
    if packer_bootstrap then
        require('packer').sync()
    end
end)
